package website.lhc.chapter1;

/**
 * <h3>简单工程模式</h3>
 * <p>只是解决对象创建问题</p>
 *
 * @author: longhc@citycloud.com.cn
 * @since: 2022/12/8 9:50
 * @version: 1.0
 */
public class CashFactory {
    public static CashSuper cashSuper(String type) {
        CashSuper cashSuper = null;
        switch (type) {
            case "1":
                cashSuper = new CashNormal();
                break;
            case "2":
                cashSuper = new CashRebate(0.8);
                break;
            case "3":
                cashSuper = new CashReturn(0.5, 100);
                break;
            default:
                return null;
        }
        return cashSuper;
    }
}
